package com.iflytek.sbd.demo.clone;

import lombok.Data;

/**
 * @program: sbd
 * @description:
 * @author: 陈英俊
 * @create: 2022-01-10 17:19
 */
@Data
public class CloneExample implements Cloneable {

    private Integer a;

    private Integer b;


    // clone()是object的protected的,不是public的,如果类不显示的重写clone(),别的类无法调用实例的clone();
    // 重写clone()的类,如果被调用clone(),类如果没有实现Cloneable,则一定抛异常CloneNotSupportedException
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}